# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-betamax
pkgver=0.9.0
pkgrel=1
pkgdesc="VCR imitation designed only for python-requests"
options="!check" # 1 Test fails, tests require internet
url="https://github.com/betamaxpy/betamax"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-requests"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/betamaxpy/betamax/archive/$pkgver.tar.gz"
builddir="$srcdir/betamax-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
6a85f21dd7ccd0d53e6c87ff4f159d295d40729098c13c435c1715252e4cbbeabb82e6347e84a16094f13a1a0249dd1c067ddc82fd36c292913ecbdb22148371  py3-betamax-0.9.0.tar.gz
"
